Make selectable labels work again
authorMatthias Clasen <mclasen@redhat.com>
Thu, 24 Mar 2011 16:44:03 +0000 (12:44 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 24 Mar 2011 16:45:59 +0000 (12:45 -0400)
You can select something, but moving the focus somewhere else, or bringing up
the context menu makes the selection go away. This makes it impossible to
copy-paste the text.

The reason for this regression is that gtk_label_state_changed was sloppy and
assumed that it would only ever be called when a labels goes insensitive, which
is no longer the case.

The patch fixes things by explicitly checking if the widget is insensitive, and
only resetting the selection in that case, which is the same behaviour we have
for e.g. GtkEntry.

gtk/gtklabel.c

index 51fd17feb5526f9a13c20bafab7800daf3c235a2..9f7c7ada06e8e26501f9ae28c546b88d13e5a320 100644 (file)
@@ -3808,7 +3808,9 @@ gtk_label_state_changed (GtkWidget   *widget,
 
   if (priv->select_info)
     {
-      gtk_label_select_region (label, 0, 0);
+      if (!gtk_widget_is_sensitive (widget))
+        gtk_label_select_region (label, 0, 0);
+
       gtk_label_update_cursor (label);
     }